package za.co.EYEWTKAH.spring.jms.common;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

public class JMSSender {

    private JmsTemplate jmsTemplate;
    private String queue;

    public void setJmsTemplate(JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }
    
    public void setQueue(String queue) {
        this.queue = queue;
    }

    public void simpleSend(final int i) {
        this.jmsTemplate.send(this.queue, new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                return session.createTextMessage("hello queue world " + i);
            }
        });
    }


}
